package com.lock.immersive.controller;

import com.lock.immersive.annotation.AuthCheck;
import com.lock.immersive.pojo.dto.OrderDetail;
import com.lock.immersive.pojo.vo.WxPayment;
import com.lock.immersive.service.OrdersService;
import com.lock.immersive.utils.ResponseApi;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/order")
public class OrderController {
    @Resource
    public OrdersService ordersService;

    @PostMapping("/unifiedOrder")
    @AuthCheck
    public ResponseApi<WxPayment> wxUnifiedOrder(@RequestBody OrderDetail detail, HttpServletRequest request) throws Exception {
        return ordersService.wxUnifiedOrder(detail, request);
    }

    @GetMapping("/queryWxOrder")
    @AuthCheck
    public ResponseApi<Object> queryWxOrder(@RequestParam("outTradeNo") String outTradeNo, HttpServletRequest request) throws Exception {
        return ordersService.queryWxOrder(outTradeNo, request);
    }

}
